﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EQual.Infrastructure.MVPFramework.Presenters
{
    public class CompositePresenter<Tview, Ttype> : ListPresenterBase<Tview, Ttype>
    {
        protected IList<IDisplayPresenter<Ttype>> _presenters;

        public void AddPresenter(IDisplayPresenter<Ttype> presenter)
        {
            _presenters.Add(presenter);
        }

        public override void Dispaly(Ttype item)
        {
            InitializeViews();

            foreach (IDisplayPresenter<Ttype> presenter in _presenters)
            {
                presenter.Dispaly(item);
            }
        }

        protected virtual void InitializeViews()
        {
            this._presenters = new List<Presenters.IDisplayPresenter<Ttype>>();
        }
    }
}
